home *** CD-ROM | disk | FTP | other *** search
/ PC-Blue - MS DOS Public Domain Library / PC-Blue MS-DOS Public Domain Library - NYACC.iso / vol086 / roff4.h < prev    next >
Encoding:
C/C++ Source or Header  |  1986-12-15  |  8.8 KB  |  276 lines

  1. /********************************************************/
  2. /*                            */
  3. /*            ROFF4, Version 1.60            */
  4. /*                            */
  5. /*(C) 1983,4 by Ernest E. Bergmann            */
  6. /*        Physics, Building #16            */
  7. /*        Lehigh Univerisity            */
  8. /*        Bethlehem, Pa. 18015            */
  9. /*                            */
  10. /* Permission is hereby granted for all commercial and    */
  11. /* non-commercial reproduction and distribution of this    */
  12. /* material provided this notice is included.        */
  13. /*                            */
  14. /********************************************************/
  15. /*FEB 19, 1984*/
  16. /*Jan 15, 1984*/
  17. /********************************************************/
  18. /* March 1984  DeSmet C version */
  19. /* Henry Harpending*/
  20. /* Anthropology Department*/
  21. /* University of New Mexico*/
  22. /* Albuquerque, NM  87131*/
  23. /*********************************************************/
  24. /*June 27, 1983 eliminate directed input*/
  25.  
  26. typedef int FILE;
  27.  
  28. #define stdin 0
  29. #define stdout 1
  30. #define stderr 2
  31.  
  32. #define NULL 0
  33. #define TRUE 1
  34. #define FALSE 0
  35. #define EOF -1
  36. #define ERR -1
  37. #define ERROR (0)
  38. #define CPMEOF 26
  39. #define STDERR 2
  40.  
  41. #define MAXLINE 512
  42.  
  43. int     debug;
  44.  
  45. int PAGESTOP;
  46. int JUSTIFY;
  47. int FFEED;
  48. int FIRSTPAGE,LASTPAGE;/*for selectively printing output*/
  49. int SUPPRESS;/*if true,no output is passed by putchar()*/
  50.  
  51.  
  52. /* send error messages to console while in DIO */
  53. #define STKSIZ        3
  54. #define DEBUG        ( debug != 0 )
  55. #define HUGE        135    /* generally large number */
  56. #define LSZ        255    /* line buffer size*/
  57. #define    COMMAND        '.'    /* all commands starts with this */
  58.  
  59. #define    UNKNOWN        -1    /* returned if doesn't recg. command */
  60. #define    NO_VAL        -32760    /* returned when no argument w/commad */
  61. #define WE_HAVE_A_WORD   1       /* returned by getwrd func. */
  62. #define    NO        0
  63. #define    YES        1
  64. #define UNDERLINE    '\137'
  65. #define    CR        0x0D
  66. #define BACKSPACE    '\b'
  67. #define NUMSIGN        '#'    /* for title strings */
  68. #define NEWLINE        '\n'
  69. #define TAB        '\t'
  70. #define BLANK        ' '
  71. #define FORMF        0x0C    /* formfeed for printer */
  72. #define SQUOTE        0x27    /* single quote */
  73. #define DQUOTE        0x22    /* double quote */
  74. #define TRSIZ        2000    /*size of TRTBL*/
  75.  
  76. #define TRANSLATE 2    /* May 23, 1983*/
  77. #define BLACK 1
  78. #define WHITE 0
  79. #define CONTROL -1
  80. #define SENTINEL -2
  81. #define HTAB    -3
  82. #define OTHERS -4
  83. #define XCHAR '-'
  84. #define UCHAR '_'
  85.  
  86. #define FI        1    /* fill lines */
  87. #define TI        2    /* temporary indent */
  88. #define BP        3    /* begin page  */
  89. #define BR        4    /* causes break */
  90. #define CE        5    /* center line(s) */
  91. #define IN        7    /* left indent */
  92. #define LS        8    /* line spacing */
  93. #define NF        9    /* no fill */
  94. #define PL        10    /* set page length */
  95. #define RM        11    /* set right margin */
  96. #define SP        12    /* add blank line(s) */
  97. #define ST        13    /* stop(pause) at page start?*/
  98. #define FO        14    /* footer title */
  99. #define HE        15    /* header title */
  100. #define M1        16    /* top margin */
  101. #define M2        17    /* second top margin */
  102. #define M3        18    /* first bottom margin */
  103. #define M4        19    /* bottom-most margin       */
  104. #define IG        20    /* "ignore";comments,Nov 6,82*/
  105. #define NE        21    /* "need";Nov 7,82*/
  106. #define FF        22    /* "formfeed";Nov 10*/
  107. #define SC        23    /* "space character";Nov13*/
  108. #define OW        24    /* "output width";Nov 13*/
  109. #define TS        25    /* "tabsize";Nov 13*/
  110. #define EH        26    /* "even headers";Nov 14*/
  111. #define OH        27    /* "odd headers"*/
  112. #define EF        28    /* "even footers"*/
  113. #define OF        29    /* "odd footers"*/
  114. #define AB        30    /* "abort";Nov 15*/
  115. #define DB        31    /* "debug"*/
  116. #define TC        32    /* "translation flag char"*/
  117. #define TR        33    /* "def translation string"*/
  118. #define CF        34    /* Dec 4:control flag char*/
  119. #define IC        35    /* insert character */
  120. #define OU        36    /* output */
  121. #define JU        37    /* right justify?*/
  122. #define NJ        38    /* don't right justify*/
  123. #define WH        39    /* whole line spacing code*/
  124. #define FR        40    /* fractional spacing,code*/
  125. #define DS        41    /*define string*/
  126. #define DM        42    /*define macro*/
  127. #define EM        43    /*end macro*/
  128. #define RG        44    /*register variable*/
  129. #define DI        45    /*diversion*/
  130. #define ED        46    /*end diversion*/
  131. #define SO        47    /*"source", include*/
  132. #define PC        48    /*printer control definition*/
  133. #define SA        49    /*"say" inline msg to console*/
  134. #define BJ        50    /*break with rightjustification
  135.                 of current line*/
  136. int FILL;    /* set to YES or NO */
  137. int _FILL[STKSIZ];    /*convert global value to a stack*/
  138. int LSVAL;    /* line spacing value -> default will be 1 */
  139. int _LSVAL[STKSIZ];
  140. int TIVAL;    /* temporary indent -> default  0 */
  141. int INVAL;    /* left indent -> default  0 */
  142. int _INVAL[STKSIZ];
  143. int RMVAL;    /* right margin -> default  PAGEWIDTH */
  144. int _RMVAL[STKSIZ];
  145. int CEVAL;    /* set equal to number of lines to be centered    */
  146. int TCVAL;    /*translation flag char*/
  147. int _TCVAL[STKSIZ];
  148.         /* default is 0                                   */
  149. int SPVAL;    /* blank lines to be spaced down */
  150.  
  151. int CURPAG;    /* current output page number; init = 0 */
  152. int NEWPAG;    /* next output page number; init = 1 */
  153. int VLINENO;    /* virtual (intended) line advances on page,
  154.             see vadv()*/
  155. int FVLINENO;    /* + line fraction */
  156. int PLINENO;    /* printer's actual line advances on page,
  157.             see padv()*/
  158. int FPLINENO;    /* + line fraction */
  159. int PLVAL;    /* page length in lines */
  160. int _PLVAL[STKSIZ];
  161. int M1VAL;    /* margin before& including header in lines*/
  162. int _M1VAL[STKSIZ];
  163. int M2VAL;    /* margin after header in lines*/
  164. int _M2VAL[STKSIZ];
  165. int M3VAL;    /* margin after last text line in lines*/
  166. int _M3VAL[STKSIZ];
  167. int M4VAL;    /* bottom margin, including footer in lines*/
  168. int _M4VAL[STKSIZ];
  169. int BOTTOM;    /* end of text area in lines;start of M3+M4 */
  170. int SCVAL;    /* space character*/
  171. int _SCVAL[STKSIZ];
  172. int OWVAL;    /* output device width*/
  173. int _OWVAL[STKSIZ];
  174. int TABSIZ;    /* spacing of tabstops*/
  175. int _TABSIZ[STKSIZ];
  176. int SENTENCE;    /* Nov 20*/
  177. int CFVAL;    /*Dec 4:control flag character value*/
  178. int _CFVAL[STKSIZ];
  179. int ICVAL;    /*insert character*/
  180. int _ICVAL[STKSIZ];
  181.  
  182. char LINE[ LSZ ];    /*input line buffer, Nov 26*/
  183. char EHEAD[ LSZ ],*EH2,*EH3;    /* even header title */
  184. char OHEAD[ LSZ ],*OH2,*OH3;    /* odd header title */
  185. char EFOOT[ LSZ ],*EF2,*EF3;    /* even footer title */
  186. char OFOOT[ LSZ ],*OF2,*OF3;    /* even footer title */
  187.  
  188.  
  189. /* defaults for global parameters */
  190.  
  191. #define FI_DEF        1
  192. #define    LS_DEF        1
  193. #define    IN_DEF        0
  194. #define    RM_DEF        60
  195. #define    TI_DEF        0
  196. #define    CE_DEF        1
  197. #define    UL_DEF        -1
  198. #define M1_DEF        2
  199. #define M2_DEF        2
  200. #define M3_DEF        2
  201. #define M4_DEF        2
  202. #define PL_DEF        66
  203. #define FF_DEF        YES    /* .ff defaults to "on" */
  204. #define FF_INI        NO    /* initial setting*/
  205. #define SC_INI        BLANK
  206. #define OW_INI        60    /*initial output width*/
  207. #define TS_DEF        8    /*standard tabsize*/
  208. #define TC_DEF        '~'    /*translation flag default*/
  209. #define CF_DEF        '^'    /*Dec 4*/
  210. #define IC_DEF        '\\'
  211. #define CW_DEF        12    /* 12/120" */
  212. #define JU_INI        YES    /*right justification*/
  213. #define REGDEF         1    /*default for register var.*/
  214.                 /*when .rg has no numeric arg*/
  215.  
  216. int DIR;    /* for "spreading" of lines    */
  217. int OUTWRDS;    /* no. words in OUTBUF; init = 0 */
  218. char OUTBUF[ LSZ ];    /*lines to be filled collected here */
  219. int OUTW;    /*current display width of OUTBUF*/
  220. int OUTPOS;    /* =strlen(OUTBUF) */
  221. int WTOP,LTOP,OUTTOP;    /*zero|negative;levels of subscripts*/
  222. int WBOT,LBOT,OUTBOT;    /*zero|positive;levels of subscripts*/
  223. int OLDLN;        /*position of previous main line*/
  224. int OLDBOT;        /*OUTBOT for previous line;reset
  225.             each page*/
  226. int FRQ,FRVAL;    /* fractional line?, what fraction size*/
  227. char *FRSTRING; /* ^ to code for fractional spacing*/
  228. char *WHSTRING;    /* ^ to code for whole line spacing*/
  229. char *CPTR[128-' '];    /*pointer table for print control*/
  230. char *TPTR[128-' '];    /*pointer table for translation strings
  231.               for char; initialize to null */
  232. char TRTBL[TRSIZ];    /*holds translation strings*/
  233. char *TREND;        /*^to end of above;init = TRTBL*/
  234. int DLINK;        /*^ head of diversion list*/
  235. int *RLINK;        /*^ head of register variable list*/
  236. int *SLINK,*MLINK;    /*points to head of linked
  237.             string, macro lists*/
  238. FILE ifp,ofp;
  239. /*following added for buffered and formatted output:  */
  240. char OUTBUF2[LSZ];    /*for line to be output in fancy fmt*/
  241. int BPOS,CP,PP;        /*buffer,column,printer positions*/
  242. char XBUF[LSZ];        /*strikout buffer*/
  243. int XF,XCOL;        /* " flag and column */
  244. char UBUF[LSZ];        /*underline buffer*/
  245. int UF,UCOL;        /* " flag and column */
  246. int FIRST;        /*flag for first pass*/
  247. char DBUF[LSZ];        /*double strike buffer*/
  248. int DPOS;
  249. int OCNT;
  250. int MCNT;
  251. int BLKCNT;
  252.  
  253. #define    REVSCROLL    FALSE
  254. #define CANBS        FALSE
  255.  
  256. #define BACKSIZE    LSZ
  257. char BACKBUF[BACKSIZE];
  258. int BINP;    /*position in above;init to 0*/
  259. #define BELL    '\007'
  260. char KEYBD;        /*boolean & prompt for keyboard input*/
  261. char KLINE[MAXLINE];    /*keyboard line input buffer*/
  262. char *KPTR;        /*pointer for above*/
  263.  
  264. struct divfd
  265.     {char *nm;    /*name*/
  266.     int cs;        /*character count*/
  267.     int ls;        /*line count*/
  268.     FILE bf; /*to iobuf if open, FALSE otherwise*/
  269. };
  270.  
  271. #define FMAX        4    /* # of additional files open*/
  272. int    FPTR;
  273. FILE FSTACK[FMAX];
  274. int    TFLAG;/*added for start(), complete()*/
  275. int XF2,UF2,MCNT2;
  276.